package cn.cvs.service.impl;

import cn.cvs.dao.SupplierDao;
import cn.cvs.pojo.Supplier;
import cn.cvs.service.SupplierService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SupplierServiceImpl implements SupplierService {

    @Autowired
    private SupplierDao supplierDao;


    @Override
    public List<Supplier> findAllSupplier() {
        return supplierDao.findAllSupplier();
    }

    @Override
    public List<Supplier> findSupplier(String supCode, String supName, Integer pageIndex, Integer pageSize) {
        return supplierDao.findSupplier(supCode,supName,(pageIndex -1) * pageSize ,pageSize);
    }

    @Override
    public Integer getUserCount(String supCode, String supName) {
        return supplierDao.getUserCount(supCode,supName);
    }

    @Override
    public Supplier getByIdOrSupplier(Integer id) {
        return supplierDao.getByIdOrSupplier(id);
    }

    @Override
    public int delSupplier(Integer id) {
        return supplierDao.delSupplier(id);
    }


    @Override
    public int addSupplier(Supplier supplier) {
        return supplierDao.addSupplier(supplier);
    }

    @Override
    public int updateSupplier(Supplier supplier) {
        return supplierDao.updateSupplier(supplier);
    }

    @Override
    public int supplierCount(Integer id) {
        return supplierDao.supplierCount(id);
    }
}
